package com.chinasoft.controller;

import com.chinasoft.pojo.DayTrafficTrendAnalysis;
import com.chinasoft.pojo.HourTrafficTrendAnalysis;
import com.chinasoft.result.Result;
import com.chinasoft.service.TrafficTrendDataService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.CrossOrigin;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

@RestController
@RequestMapping("trafficTrendData")
@CrossOrigin
public class TrafficTrendDataController {

    @Autowired
    private TrafficTrendDataService trafficTrendDataService;

    /**
     * 获取所有天流量趋势数据
     */
    @GetMapping("day")
    public Result<List<DayTrafficTrendAnalysis>> getAllDayTrafficTrendData() {
        List<DayTrafficTrendAnalysis> dayTrafficTrendData = trafficTrendDataService.getAllDayTrafficTrendData();
        return Result.success(dayTrafficTrendData);
    }

    /**
     * 获取所有小时流量趋势数据
     */
    @GetMapping("hour")
    public Result<List<HourTrafficTrendAnalysis>> getTrafficTrendData() {
        List<HourTrafficTrendAnalysis> hourTrafficTrendData = trafficTrendDataService.getAllHourTrafficTrendData();
        return Result.success(hourTrafficTrendData);
    }
}
